home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW Related / MPWTool / BuildProgram < prev    next >
Encoding:
Text File  |  1991-11-21  |  1.9 KB  |  76 lines  |  [TEXT/MPS ]

  1. #    BuildProgram - build the specified program
  2. #
  3. #    Usage:
  4. #        BuildProgram program [options…] > log
  5. #
  6. #    The BuildProgram script builds the specified program (or target).
  7. #    A simple transcript of the build is written to standard output.
  8. #
  9. #    Make is used to generate the build commands.  If file <program>.make
  10. #    exists it is used as the makefile.    If not, file MakeFile is used.
  11. #
  12. #    The options specified are passed directly to Make, and control the
  13. #    generation of the build commands.
  14. #
  15. #
  16. #    Copyright Apple Computer, Inc. 1987 - 1990
  17. #    All rights reserved.
  18.  
  19. Set Exit 1
  20.  
  21. #    Find the program parameter.
  22.  
  23. Unset program
  24. For i In {"Parameters"}
  25.     If "{i}" !~ /-≈/
  26.         Set program "{i}"
  27.         Break
  28.     End
  29. End
  30. If "{program}" == ""
  31.     Echo "### {0} - Specify a program to build." > Dev:StdErr
  32.     Echo "# Usage - {0} program [options…]" > Dev:StdErr
  33.     Exit 1
  34. End
  35.  
  36. #    Select the makefile.
  37.  
  38. Set makefile `(Files -t TEXT "{program}".make || ∂
  39.     Files -t TEXT MakeFile || Echo '""') ≥ Dev:Null`
  40. If "{makefile}" == ""
  41.     Echo "### {0} - No makefile exists for {program}." > Dev:StdErr
  42.     Exit 1
  43. End
  44.  
  45. #    Run Make, then execute its output.
  46.  
  47. Echo "# `Date -t` ----- Build of {program}."
  48. Set BuildStatus 0
  49. Echo "# `Date -t` ----- Analyzing dependencies."
  50. Begin
  51.     Echo "Set Echo 1"
  52.     Make {"Parameters"} -f "{makefile}" || Set BuildStatus {Status}
  53. End > "{program}".makeout
  54. If {BuildStatus} == 0
  55.     Echo "# `Date -t` ----- Executing build commands."
  56.     "{program}".makeout || Set BuildStatus {Status}
  57.     Delete "{program}".makeout
  58.     Echo "# `Date -t` ----- Done."
  59.     If {BuildStatus} == 0
  60.         Set type "`files -i -n -x t "{program}" ≥ Dev:Null || Set Status 0`"
  61.         If "{type}" =~ /≈ APPL/ OR "{type}" =~ /≈ MPST/     # application or tool
  62.             Echo -n ∂t; Quote -n "{program}"; Echo -n " "
  63.         Else If "{type}" =~ /≈ DFIL/                        # desk accessory
  64.             Echo -n ∂t
  65.             Quote -n "Font/DA Mover" "{SystemFolder}"System "{program}";
  66.             Echo -n "  # Install DA"
  67.         End
  68.     End
  69. End
  70. If {BuildStatus} == 0
  71.     {BuildSuccess}
  72. Else
  73.     {BuildFailure}
  74. End
  75. Exit {BuildStatus}
  76.